{% extends "base.html" %}

{% load tags %}

{% block head %}
	<script type="text/javascript" src="/media/javascript/multiline_tooltip.js"></script>
	<script language="javascript" src="/media/javascript/attachment_form.js"></script>
	<script language="javascript" type="text/javascript">
		<!-- Hide Javascript
		
			function loadPage()
			{
				init("size_checkbox", "ctype_checkbox", "name_checkbox", "ext_checkbox",
					"id_how_many", "id_how_many_operator");
				
				var disable1 = document.getElementById("id_size").value == "";
				document.getElementById(checkbox1_id).checked = disable1 ? false : true;
				document.getElementById("id_size").disabled = disable1 ? true : false;
				document.getElementById("id_size_operator").disabled = disable1 ? true : false;
								
				var disable2 = document.getElementById("id_contentType").value == "";
				document.getElementById(checkbox2_id).checked = disable2 ? false : true;
				document.getElementById("id_contentType").disabled = disable2 ? true : false;
				document.getElementById("id_contentSubtype").disabled = disable2 ? true : false;

				var disable3 = document.getElementById("id_name").value == "";
				document.getElementById(checkbox3_id).checked = disable3 ? false : true;
				document.getElementById("id_name").disabled = disable3 ? true : false;
				document.getElementById("id_name_operator").disabled = disable3 ? true : false;
				
				var disable4 = document.getElementById("id_ext").value == "";
				document.getElementById(checkbox4_id).checked = disable4 ? false : true;
				document.getElementById("id_ext").disabled = disable4 ? true : false;
				document.getElementById("id_ext_operator").disabled = disable4 ? true : false;
				
				enableHowMany ();
			}
			
		-->
	</script>
	<noscript>
		<h3>Ta strona wymaga obsługi Javascript!</h3>
	</noscript>		
	
{% endblock %}

{% block bodyEvent %}
	onLoad="loadPage();"
{% endblock bodyEvent %}

{% block title %}
	System filtrujący
{% endblock title %}

{% block subtitle %}
	Zdefiniuj warunek dotyczący załącznika.
	{% if form.errors %}
		<font class="pink">Popraw błędy!</font>
	{% endif %}
{% endblock subtitle %}

{% block content %}

	{{form.errors}}

	<div class="form">
		<form name="aform" method="post" action="{% url zatwierdz_warunek tmp_ruleid ATTACHMENT_C condid ruleid %}" > {% csrf_token %}
			<div class="container">
			
				<table class="no-header">
					<tr>
						<td>
							<input type="checkbox" id="size_checkbox" 
								onClick="enablePart('size_checkbox', 'id_size', 'id_size_operator');" />
						</td>
						<td>Wielkość załącznika jest</td>
						<td class="center">{{ form.size_operator }}
							{% if form.size_operator.errors %}
								<div id="tooltip_size_operator" class="xstooltip">
									{{ form.size_operator.errors }}
								</div> 							
								<img
									src="/media/images/warning.png" 
									id="warning_size_operator" 
									onmouseover="xstooltip_show('tooltip_size_operator', 'warning_size_operator', 250, 100);"
									onmouseout="xstooltip_hide('tooltip_size_operator');" 
								/>
							{% endif %}
						</td>
						<td>{{form.size}}
							{% if form.size.errors %}
								<div id="tooltip_size" class="xstooltip">
									{{form.size.errors}}
								</div> 							
								<img
									src="/media/images/warning.png" 
									id="warning_size" 
									onmouseover="xstooltip_show('tooltip_size', 'warning_size', 250, 100);"
									onmouseout="xstooltip_hide('tooltip_size');" 
								/>
							{% endif %}
						</td>
						<td>kB.</td>
					</tr>
					<tr>
						<td>
							<input type="checkbox" id="ctype_checkbox" 
								onClick="enablePart('ctype_checkbox', 'id_contentType', 'id_contentSubtype');" />
						</td>
						<td>Typ załącznika to</td>
						<td class="center">{{ form.contentType }}
							{% if form.contentType.errors %}
								<div id="tooltip_contentType" class="xstooltip">
									{{form.contentType.errors}}
								</div> 							
								<img
									src="/media/images/warning.png" 
									id="warning_contentType" 
									onmouseover="xstooltip_show('tooltip_contentType', 'warning_contentType', 250, 100);"
									onmouseout="xstooltip_hide('tooltip_contentType');" 
								/>
							{% endif %}
						</td>
						<td>{{ form.contentSubtype }}
							{% if form.contentSubtype.errors %}
								<div id="tooltip_contentSubtype" class="xstooltip">
									{{form.contentSubtype.errors}}
								</div> 							
								<img
									src="/media/images/warning.png" 
									id="warning_contentSubtype" 
									onmouseover="xstooltip_show('tooltip_contentSubtype', 'warning_contentSubtype', 250, 100);"
									onmouseout="xstooltip_hide('tooltip_contentSubtype');" 
								/>
							{% endif %}
						</td>
						<td>.</td>
					</tr>
					<tr>
						<td>
							<input type="checkbox" id="name_checkbox" 
								onClick="enablePart('name_checkbox', 'id_name', 'id_name_operator');" />
						</td>
						<td>Nazwa załącznika</td>
						<td class="center">{{ form.name_operator }}
							{% if form.name_operator.errors %}
								<div id="tooltip_name_operator" class="xstooltip">
									{{form.name_operator.errors}}
								</div> 							
								<img
									src="/media/images/warning.png" 
									id="warning_name_operator" 
									onmouseover="xstooltip_show('tooltip_name_operator', 'warning_name_operator', 250, 100);"
									onmouseout="xstooltip_hide('tooltip_name_operator');" 
								/>
							{% endif %}
						</td>
						<td>{{ form.name }}
							{% if form.name.errors %}
								<div id="tooltip_name" class="xstooltip">
									{{form.name.errors}}
								</div> 							
								<img
									src="/media/images/warning.png" 
									id="warning_name" 
									onmouseover="xstooltip_show('tooltip_name', 'warning_name', 250, 100);"
									onmouseout="xstooltip_hide('tooltip_name');" 
								/>
							{% endif %}
						</td>
						<td>.</td>
					</tr>
					<tr>
						<td>
							<input type="checkbox" id="ext_checkbox" 
								onClick="enablePart('ext_checkbox', 'id_ext', 'id_ext_operator');" />
						</td>
						<td>Rozszerzenie załącznika</td>
						<td class="center">{{ form.ext_operator }}</td>
						<td>{{ form.ext }}
							{% if form.ext.errors %}
								<div id="tooltip_ext" class="xstooltip">
									{{form.ext.errors}}
								</div> 							
								<img
									src="/media/images/warning.png" 
									id="warning_ext" 
									onmouseover="xstooltip_show('tooltip_ext', 'warning_ext', 250, 100);"
									onmouseout="xstooltip_hide('tooltip_ext');" 
								/>
							{% endif %}
						</td>
						<td>.</td>
					</tr>
					<tr>
						<td></td>
						<td>Ilość załączników, które spełniają te warunki jest</td>
						<td class="center">{{ form.how_many_operator }}
							{% if form.how_many_operator.errors %}
								<div id="tooltip_how_many_operator" class="xstooltip">
									{{form.how_many_operator.errors}}
								</div> 							
								<img
									src="/media/images/warning.png" 
									id="warning_how_many_operator" 
									onmouseover="xstooltip_show('tooltip_how_many_operator', 'warning_how_many_operator', 250, 100);"
									onmouseout="xstooltip_hide('tooltip_how_many_operator');" 
								/>
							{% endif %}
						</td>
						<td>{{ form.how_many }}
							{% if form.how_many.errors %}
								<div id="tooltip_how_many" class="xstooltip">
									{{form.how_many.errors}}
								</div> 							
								<img
									src="/media/images/warning.png" 
									id="warning_how_many" 
									onmouseover="xstooltip_show('tooltip_how_many', 'warning_how_many', 250, 100);"
									onmouseout="xstooltip_hide('tooltip_how_many');" 
								/>
							{% endif %}
						</td>
						<td>.</td>				
					</tr>
				</table>
						
			</div>
			<input type="submit" name="cancel" id="cancel" class="button" value="anuluj" />
			<input type="submit" name="submit" id="submit" class="button" value="potwierdź" />
		</form>
	</div>
	
{% endblock content %}
{% block backto %}
	{{ begin_backto }}
	<li><a href="/filtr/">lista reguł filtrowania</a></li>
{% endblock %}

{% block help %}
{% endblock help %}

